package cn.jsc.org.service.impl;

import cn.jsc.basic.service.impl.BaseServiceImpl;
import cn.jsc.org.domain.Dic;
import cn.jsc.org.mapper.DicMapper;
import cn.jsc.org.mapper.DicerMapper;
import cn.jsc.org.service.IDicServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 部门服务层
 */
@Service
public class DicServiceImpl extends BaseServiceImpl<Dic> implements IDicServiceI {
    @Autowired
    private DicMapper dicMapper;
    @Autowired
    private DicerMapper dicerMapper;
    /**
     * 删除
     * @param id
     */
    @Override
    @Transactional
    public void delete(Long id) {
        //先删除子表
        dicerMapper.remove(id);
        //再删除父表
        dicMapper.remove(id);
    }

    /**
     * 批量删除
     * @param ids
     */
    @Override
    @Transactional
    public void patchDelete(List<Long> ids) {
        //先删除子表
        dicerMapper.patchDelete(ids);
        //再删除父表
        dicMapper.patchDelete(ids);

    }

}
